package com.tmx.server;


import tiled.gwt.Map;
import tiled.gwt.server.TMXMapReader;


//import com.google.gson.Gson;
import com.google.gwt.user.server.rpc.RemoteServiceServlet;
import com.tmx.client.GameService;

public class GameServiceImpl extends RemoteServiceServlet implements GameService {
	private static final long serialVersionUID = 1L;

	public Map getGameData() throws IllegalArgumentException {

        Map map;
        try {
            TMXMapReader mapReader = new TMXMapReader();
            map = mapReader.readMap("desert.tmx");

            //Gson j = new Gson();
            //System.out.println(j.toJson(map));
    		return(map);
            
            
        } catch (Exception e) {
            System.out.println("Error while reading the map:\n" + e.getMessage());
            return null;
        }

        
		
		
        
	}

}
